USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0002_ENDEUDAMIENTO_MAXIMO]    Script Date: 11/24/2011 14:32:30 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WASP_M0002_ENDEUDAMIENTO_MAXIMO]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[WASP_M0002_ENDEUDAMIENTO_MAXIMO]
GO

USE [BMIG_Mensual_POST_CADENA]
GO

/****** Object:  StoredProcedure [dbo].[WASP_M0002_ENDEUDAMIENTO_MAXIMO]    Script Date: 11/24/2011 14:32:30 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE PROCEDURE [dbo].[WASP_M0002_ENDEUDAMIENTO_MAXIMO]
AS 
BEGIN  
	SELECT	DISTINCT z07391su1 AS suc
			,z07391ct1 AS cta
			,z07391op1 AS oper
			,z07391EMX AS endeu
			,z07391EDS AS disponible
			,z07391ana AS analista
			,ubnom	
	INTO	endeuda_maximo
	FROM	z07391 LEFT JOIN fst746 ON z07391ana = Ubuser
	ORDER BY z07391op1
END

GO


